<?php

    class Comments_Controller extends Application {
        
        function setup()
        {
            $this->actions = array('index','moderate','search','delete','options');
            $this->before_filter('is_logged_in');	
            $this->before_filter('has_access');					
			$this->use_layout('admin_layout.php');
        }
        
        function has_access()
        {
            if (!has_access_to('News::Manage Comments')) $this->redirect_to(array('controller'=>'admin/dashboard' ));
        }
        
		function index() 
		{
		}


		function moderate() 
		{
		}


		function search() 
		{
		}


		function delete() 
		{
		    use_model('comments');
		    $comments = new Comments();
		    if ($this->is_post()) {
		        if ($comments->load( (int) $_POST['id'])) {
		            $comments->delete();
		            flash('notice','Comment has been removed.');
		        } else {
		            flash('notice', 'Comment failed to load.');
		        }
		    }
		    
		    $this->redirect_to('index');
		}
		
		// use the admin config bits
		function options()
		{
		    
		}

        
    }

?>